import java.util.Random;
import java.util.Scanner;

public class random {
    //猜数字
    public static void main(String[] args) {
        Random random = new Random();
        int n = random.nextInt(101);
        Scanner scanner = new Scanner(System.in);
        while(true){
            System.out.print("请猜数字：");
            int i = scanner.nextInt();
            if(i > n){
                System.out.println("猜大了");
            }else if(i < n){
                System.out.println("猜小了");
            }else{
                System.out.println("猜对了");
                break;
            }
        }
    }
    //java当中 如何生成一个简单的随机数
    public static void main1(String[] args) {
        Random random = new Random();
//        int n = random.nextInt(100)+1;//[0,100) [1,101)
//        int n = random.nextInt(50)+50;//生成[0-49]+50 ->50-99
        int n = random.nextInt(102);//[0-101]
        System.out.println(n);
    }
}
